<?php $this->load->view('layout/header');?>
<div class="container-fluid">
    <div class="row-fluid">
        <div class="span12">
            <h3 class="page-title">建行批量转账记录<small> 详情</small></h3>
            <?php echo breadcrumb(array('transferRecord/grid'=>'景区扫码转账记录', '记录详细')); ?>
        </div>
    </div>
    <?php echo execute_alert_message() ?>
    <div class="row-fluid">
        <div class="span6">
            <div class="portlet sale-summary">
                <div class="portlet-title">
                    <div class="caption">记录详细</div>
                    <div class="tools">
                        <a class="collapse" href="javascript:;"></a>
                        <a class="remove" href="javascript:;"></a>
                    </div>
                </div>
                <ul class="unstyled">
                    <li>
                        <span class="sale-info">交易编号</span> 
                        <span class="sale-num"><?php echo $transferInfo->transfer_id;?></span>
                    </li>
                    <li>
                        <span class="sale-info">交易类型</span> 
                        <span class="sale-num"><?php echo ($transferInfo->transfer_type == 1) ? '批量打款' : '单笔'; ?></span>
                    </li>
                    <li>
                        <span class="sale-info">交易状态</span> 
                        <span class="sale-num">
                            <?php switch ($transferInfo->status) {
                                case 1:
                                    echo '交易成功';
                                    break;
                                case 2:
                                    echo '交易失败';
                                    break;
                                default:
                                    echo '待发起交易';
                                    break;
                            } ;?>
                        </span>
                    </li>

                    <li>
                        <span class="sale-info">消息 </span>
                        <span class="sale-num"><?php echo $transferInfo->message; ?></span>
                    </li>
                    <li>
                        <span class="sale-info">结算时间 </span> 
                        <span class="sale-num"><?php echo $transferInfo->start_time, '至', $transferInfo->created_at; ?></span>
                    </li>
                    <li>
                        <span class="sale-info">交易时间 </span>
                        <span class="sale-num"><?php echo $transferInfo->updated_at; ?></span>
                    </li>
                </ul>
            </div>
        </div>
        <div class="span6">
            <div class="portlet sale-summary">
                <div class="portlet-title">
                    <div class="caption">交易信息</div>
                    <div class="tools">
                        <a class="collapse" href="javascript:;"></a>
                        <a class="remove" href="javascript:;"></a>
                    </div>
                </div>
                <ul class="unstyled">
                    <li>
                        <span class="sale-info">交易总额</span> 
                        <span class="sale-num"><?php echo $transferInfo->total_amount;?></span>
                    </li>
                    <li>
                        <span class="sale-info">交易总笔数</span> 
                        <span class="sale-num"><?php echo $transferInfo->total_num;?></span>
                    </li>

                    <li>
                        <span class="sale-info">实际交易金额</span> 
                        <span class="sale-num"><?php echo $transferInfo->actual_amount;?></span>
                    </li>
                    <li>
                        <span class="sale-info">实际交易笔数</span> 
                        <span class="sale-num"><?php echo $transferInfo->actual_num;?></span>
                    </li>

                    <li>
                        <span class="sale-info">成功总金额</span> 
                        <span class="sale-num"><?php echo $transferInfo->success_amount;?></span>
                    </li>
                    <li>
                        <span class="sale-info">成功总笔数</span> 
                        <span class="sale-num"><?php echo $transferInfo->success_num;?></span>
                    </li>
                </ul>
            </div>
        </div>
    </div>
    <?php $response_content = json_decode($transferInfo->response_content); ?>
    <?php if ( ! empty($response_content)) : ?>

    <?php if ( ! empty($response_content->SUCCESS_LIST)) : ?>
    <div class="row-fluid">
        <div class="span12">
            <div class="portlet box green">
                <div class="portlet-title">
                    <div class="caption"><i class="icon-picture"></i>成功记录</div>
                    <div class="tools">
                        <a class="collapse" href="javascript:;"></a>
                        <a class="remove" href="javascript:;"></a>
                    </div>
                </div>
                <div class="portlet-body">
                    <table class="table table-condensed table-hover">
                        <tr>
                            <th>序列号</th>
                            <th>收款帐号</th>
                            <th>收款帐号名称</th>
                            <th>金额</th>
                            <th>用途</th>
                            <!-- <th>备注1</th>
                            <th>备注2</th> -->
                            <th>单据状态</th>
                            <th>标注</th>
                            <!-- <th>收款账户支付系统联行号</th>
                            <th>收款账户开户行名称</th> -->
                        </tr>
                        
                        
                        <?php if (!empty($response_content->SUCCESS_LIST->OID)) : ?>
                            <?php $success_list = array(0 => $response_content->SUCCESS_LIST); ?>
                        <?php else : ?>
                            <?php $success_list = $response_content->SUCCESS_LIST; ?>
                        <?php endif; ?>
                        
                        <?php foreach ($success_list as $item) : ?>
                        <tr>
                            <td><?php echo $item->OID;?></td>
                            <td><?php echo $item->RECV_ACCNO;?></td>
                            <td><?php echo $item->RECV_ACCNAME;?></td>
                            <td><?php echo (float)$item->AMOUNT;?></td>
                            <td><?php echo $item->USEOF;?></td>
                            <!-- <td><?php echo $item->FILE_MEMO1;?></td> -->
                            <!-- <td><?php echo $item->FILE_MEMO2;?></td> -->
                            <td><?php echo '成功';?></td>
                            <td><?php echo empty($item->REMARK) ? '' : $item->REMARK;?></td>
                            <!-- <td><?php echo $item->UBANK_NO;?></td> -->
                            <!-- <td><?php echo $item->UBANK_NAME;?></td> -->
                        </tr>
                        <?php endforeach;?>
                        <tr>
                            <td colspan="11"><?php echo '成功总额：', (float)$response_content->SUCCESS_AMOUNT, '   ', '成功总笔数：', (float)$response_content->SUCCESS_NUM;?></td>
                        </tr>
                    </table>
                </div>
            </div>
        </div>
    </div>
    <?php endif; ?>

    <?php if ( ! empty($response_content->FAIL_LIST)) : ?>
    <div class="row-fluid">
        <div class="span12">
            <div class="portlet box green">
                <div class="portlet-title">
                    <div class="caption"><i class="icon-picture"></i>失败记录</div>
                    <div class="tools">
                        <a class="collapse" href="javascript:;"></a>
                        <a class="remove" href="javascript:;"></a>
                    </div>
                </div>
                <div class="portlet-body">
                    <table class="table table-condensed table-hover">
                        <tr>
                            <th>序列号</th>
                            <th>收款帐号</th>
                            <th>收款帐号名称</th>
                            <th>金额</th>
                            <th>用途</th>
                            <!-- <th>备注1</th>
                            <th>备注2</th> -->
                            <th>单据状态</th>
                            <th>标注</th>
                            <!-- <th>收款账户支付系统联行号</th>
                            <th>收款账户开户行名称</th> -->
                        </tr>

                        <?php if (!empty($response_content->FAIL_LIST->OID)) : ?>
                            <?php $fail_list = array(0 => $response_content->FAIL_LIST); ?>
                        <?php else : ?>
                            <?php $fail_list = $response_content->FAIL_LIST; ?>
                        <?php endif; ?>
                        <?php foreach ($fail_list as $item) : ?>
                        <tr>
                            <td><?php echo $item->OID;?></td>
                            <td><?php echo $item->RECV_ACCNO;?></td>
                            <td><?php echo $item->RECV_ACCNAME;?></td>
                            <td><?php echo (float)$item->AMOUNT;?></td>
                            <td><?php echo $item->USEOF;?></td>
                            <!-- <td><?php echo $item->FILE_MEMO1;?></td> -->
                            <!-- <td><?php echo $item->FILE_MEMO2;?></td> -->
                            <td><?php echo '失败';?></td>
                            <td><?php echo empty($item->REMARK) ? '' : $item->REMARK;?></td>
                            <!-- <td><?php echo $item->UBANK_NO;?></td> -->
                            <!-- <td><?php echo $item->UBANK_NAME;?></td> -->
                        </tr>
                        <?php endforeach;?>
                        <tr>
                            <td colspan="11"><?php echo '失败总额：', (float)$response_content->FAIL_AMOUNT, '   ', '失败总笔数：', (float)$response_content->FAIL_NUM;;?></td>
                        </tr>
                    </table>
                </div>
            </div>
        </div>
    </div>
    <?php endif; ?>
    
    <?php if ( ! empty($response_content->UNCERTAIN_LIST)) : ?>
    <div class="row-fluid">
        <div class="span12">
            <div class="portlet box green">
                <div class="portlet-title">
                    <div class="caption"><i class="icon-picture"></i>不确定记录</div>
                    <div class="tools">
                        <a class="collapse" href="javascript:;"></a>
                        <a class="remove" href="javascript:;"></a>
                    </div>
                </div>
                <div class="portlet-body">
                    <table class="table table-condensed table-hover">
                        <tr>
                            <th>序列号</th>
                            <th>收款帐号</th>
                            <th>收款帐号名称</th>
                            <th>金额</th>
                            <th>用途</th>
                            <!-- <th>备注1</th>
                            <th>备注2</th> -->
                            <th>单据状态</th>
                            <th>标注</th>
                            <!-- <th>收款账户支付系统联行号</th>
                            <th>收款账户开户行名称</th> -->
                        </tr>

                        <?php if (!empty($response_content->UNCERTAIN_LIST->OID)) : ?>
                            <?php $uncertain_list = array(0 => $response_content->UNCERTAIN_LIST); ?>
                        <?php else : ?>
                            <?php $uncertain_list = $response_content->UNCERTAIN_LIST; ?>
                        <?php endif; ?>
                        <?php foreach ($uncertain_list as $item) : ?>
                        <tr>
                            <td><?php echo $item->OID;?></td>
                            <td><?php echo $item->RECV_ACCNO;?></td>
                            <td><?php echo $item->RECV_ACCNAME;?></td>
                            <td><?php echo (float)$item->AMOUNT;?></td>
                            <td><?php echo $item->USEOF;?></td>
                            <!-- <td><?php echo $item->FILE_MEMO1;?></td> -->
                            <!-- <td><?php echo $item->FILE_MEMO2;?></td> -->
                            <td><?php echo '不确定';?></td>
                            <td><?php echo empty($item->REMARK) ? '' : $item->REMARK;?></td>
                            <!-- <td><?php echo $item->UBANK_NO;?></td> -->
                            <!-- <td><?php echo $item->UBANK_NAME;?></td> -->
                        </tr>
                        <?php endforeach;?>
                        <tr>
                            <td colspan="11"><?php echo '不确定总额：', (float)$response_content->UNCERTAIN_AMOUNT , '    ', '不确定总笔数：', (float)$response_content->UNCERTAIN_NUM;?></td>
                        </tr>
                    </table>
                </div>
            </div>
        </div>
    </div>
    <?php endif; ?>

    <?php endif; ?>
    <div class="form-actions">
        <a href="<?php echo site_url('transferRecord/grid'); ?>">
            <button class="btn" type="button">返回</button>
        </a>
        <a href="<?php echo base_url('transferRecord/exportTransferDetails/'. $transferInfo->transfer_id). '?token='. $token; ?>">
            <button class="btn green" type="button">交易记录导出</button>
        </a>
    </div>
</div>
<?php $this->load->view('layout/footer');?>